LEX = lex
YACC = bison
INCLUDE = -I../lib -I../../kernel
LIBS=`../lib/pfring_config --libs` -lpthread #@NDPI_LIB@
CC=@CC@
AR ?= ar
RANLIB ?= ranlib
CFLAGS=-Wall -fPIC -O2 ${INCLUDE} #@NDPI_INC@ @HAVE_NDPI@
CFLAGS+=-Wno-address-of-packed-member
OBJS=nbpf_mod_rdif.o rules.o tree_match.o parser.o lex.yy.o grammar.tab.o nbpf_mod_fiberblaze.o nbpf_mod_napatech.o
BPFLIB=libnbpf.a

all: nbpftest

$(BPFLIB): $(OBJS)
	$(AR) rs $@ $(OBJS)
	$(RANLIB) $@

nbpftest: $(BPFLIB) nbpftest.c
	${CC} $(CFLAGS) -g nbpftest.c -o nbpftest $(BPFLIB) $(LIBS)

lex.yy.c: scanner.l grammar.tab.h
	$(LEX) scanner.l

grammar.tab.h: grammar.tab.c

grammar.tab.c: grammar.y
	$(YACC) -d grammar.y

clean:
	rm -f nbpftest *~ *.o lex.yy.* grammar.tab.* $(BPFLIB)
	rm -rf *.dSYM
